<template>
    <div>
        <Header></Header>
        <div class="form">
            <h3>登陆账号</h3>
            <van-form @submit="onSubmit">
                <van-field
                    v-model="username"
                    name="mobile"
                    label="用户名"
                    placeholder="用户名"
                    :rules="[{ required: true, message: '请填写用户名' }]"
                />
                <van-field
                    v-model="password"
                    type="password"
                    name="pwd"
                    label="密码"
                    placeholder="密码"
                    :rules="[{ required: true, message: '请填写密码' }]"
                />
                <div style="margin: 16px;">
                    <van-button block type="info" native-type="submit">登录</van-button>
                </div>
            </van-form>
        </div>
    </div>
</template>


<script>
import Header from '../components/Header/Header'
export default {
    components:{
        Header,
    },
    data() {
        return {
            username: 13500000000,
            password: "",
        };
    },
    methods: {
        onSubmit(values) {
            // console.log("submit", values);
            this.$API.Login({params:{mobile:this.username,pwd:this.password}}).then(res=>{
                // console.log(res);
                localStorage.setItem('token',res.data.data.token)
                // window.history.back()
            })
        },
    },
};
</script>
<style lang="scss">
.form {
    width: 76vw;
    margin: 10vh auto;
    .van-cell {
        padding: 10px 0;
        background: #f5f5f5;
        margin: 2vh 0;
        border-radius: 2vw;
        span {
            padding-left: 3vw;
        }
    }
    button {
        background: linear-gradient(135deg, #e570e7 0%, #79f1fc 100%);
        box-shadow: 0 5px 3px rgba(0, 0, 0, 0.3);
        -webkit-tap-highlight-color: transparent;
    }
}
</style>